package com.ziq.base.utils.permission

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.blankj.utilcode.util.AppUtils
import com.ziq.base.databinding.FwDialogPermissionRemindBinding
import com.ziq.base.extension.click

class PermissionRemindPopupWindow(context: Context, title:String, content:String): PopupWindow(context) {

    var binding : FwDialogPermissionRemindBinding = FwDialogPermissionRemindBinding.inflate(LayoutInflater.from(context))
    init {
        contentView = binding.root
        setBackgroundDrawable(null)
        width = ViewGroup.LayoutParams.MATCH_PARENT
        binding.tvTitle.text = title
        binding.tvContent.text = content
        isOutsideTouchable = true
        binding.btnClose.click {
            dismiss()
        }
        binding.btnSetting.click {
            dismiss()
            AppUtils.launchAppDetailsSettings()
        }
    }

}